import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import set from '@dfeidao/atom-web/local/set';
import set_node_cls from '@dfeidao/atom-web/ui/set-node-cls';

export default async function a006(fd: IFeidaoAiBrowserComponent, e: Event) {
	// todo
	const n = e.currentTarget as HTMLInputElement;
	const no = n.getAttribute('data-no');
	let valu = "";
	if (n.checked !== true) {
		set_node_cls(n, "checked", false);
		const as = fd.data.node.querySelectorAll('[data-no="' + no + '"]:checked');
		for (let i = 0; i < as.length; i++) {
			valu += as[i].getAttribute('data-id');
		}
		set(fd, "valu" + no + "", { valu, no });
		return;
	}
	set_node_cls(n, "checked", true);
	// const valu = n.getAttribute('data-id');
	const a = fd.data.node.querySelectorAll('[data-no="' + no + '"]:checked');
	for (let i = 0; i < a.length; i++) {
		valu += a[i].getAttribute('data-id');
	}
	set(fd, "valu" + no + "", { valu, no });
}
